<template>
  <div class="page-container">
    <page_breadcrumb :getKeyMethod="init_table_model" @change="change_table_model" pageOption />
    <ex_super_table_page v-bind="option" ref="SuperTablePage" :autoPage="false" @selection-change="e => selection = e">
    </ex_super_table_page>

  </div>
</template>
<script>
import superTablePageFunction from '@/mixin/super-table-page-function';

import page_table_model_manage from '@/mixin/page_table_model_manage';
import emitOnFunction from '@/mixin/emit-on-function';
let emitKey = 'printTemplate>manage'
export default {
  title: 'label_print_template',
  mixins: [superTablePageFunction, emitOnFunction(emitKey), page_table_model_manage,],
  components: {},
  data() {
    return {
      selection: [],
      option: {
        search: {
          model: [
            { label: "label_business_type", key: "refType", type: 'select', enum: 'PrintBussinessTypeEnum' },
          ],
        },
        action: [
          {
            label: { _key: 'label_new_any', i18n: true, type: 'label_print_template' }, attrs: { icon: "el-icon-plus" },
            auth: 'oms_print_template_edit',
            click: () => {
              this.$router.push({ path: '/page/oms/setting/printTemplate/print_template_edit', query: { emitKey, } })
            }
          },
        ],
        table: {
          url: "/print-api/template/PrintTemplateCfgRpc/selectPage.json",
          model: this.init_table_model(),
        },
      },


    };
  },
  methods: {
    option_table_model() {
      return [
        {
          key: 'refType', label: 'label_business_type', 'min-width': 140, 'show-overflow-tooltip': true,
          formatter: (r, c, v, i) => this.$enumShow(v, "PrintBussinessTypeEnum")
        },
        {
          key: 'templateName', label: 'label_template_name', 'min-width': 140, 'show-overflow-tooltip': true,
        },

        {
          key: 'pageDimension', label: 'label_template_dimension', 'width': 140,
          formatter: (r, c, v, i) => this.$addUnit(`${r.pageWidth} * ${r.pageHeight}`, "mm")
        },
        { key: 'defaultFont', label: 'label_typeface', 'width': 120, 'show-overflow-tooltip': true, },
        { key: 'gmtModify', label: 'label_update_time', 'width': 140, 'show-overflow-tooltip': true, formatter: (r, c, v, i) => this.$dateFormat(v) },
        { key: 'modifier', label: 'label_update_user', 'width': 130, 'show-overflow-tooltip': true, },
        { key: 'gmtCreate', label: 'label_create_time', 'width': 140, 'show-overflow-tooltip': true, formatter: (r, c, v, i) => this.$dateFormat(v) },
        { key: 'creator', label: 'label_create_user', 'width': 130, 'show-overflow-tooltip': true, },

        {
          type: 'operate', width: 210, fixed: "right", operate: [
            {
              label: "label_edit",
              auth: 'oms_print_template_edit',
              click: (row) => {
                this.$router.push({ path: '/page/oms/setting/printTemplate/print_template_edit', query: { id: row.id, edit: true, emitKey, } })
              }
            },
            {
              label: 'label_delete',
              auth: 'oms_print_template_delete',
              type: "confirm-button", url: '/print-api/template/PrintTemplateCfgRpc/remove.json', message: 'tip_delete_template_confirm',
              buttonClass: "button_text_danger", confirmButtonType: 'danger',
              params: (row) => { return { "id": row["id"] } }, done: ['reload', 'tip']
            },

          ]
        },
      ]
    },


  }
};

</script>
<style></style>
